package com.yuan.config;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class ReceiveMessage {
    @KafkaListener(topics = "yuantopic")
    public void onMessage(ConsumerRecord<?, ?> record) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(dateFormat.format(new Date())+",简单消费，record："+record.topic()+"-"+record.partition()+"-"+record.value());
    }
}
